<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * @version $Id: edit_list_predictions.tpl.php 1126 2008-06-09 05:45:04Z julienv $
 * @package Joomleague
 * @copyright Copyright (C) 2007  JoomLeague
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see _joomleague_license.txt
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 
mosCommonHTML::loadOverlib();
?>
<form action="index2.php" method="post" name="adminForm">
<div id="right">
	<div id="rightpad">
	
<!-- Header START -->
		<div id="step">
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
				<div class="far-right">
							<div class="button1-left"><div class="help"><a href="http://www.joomleague.de" alt="<?php echo _JL_ADMIN_MANUAL;?>" title="<?php echo _JL_ADMIN_MANUAL;?>" target="blank"><?php echo _JL_ADMIN_MANUAL;?></a></div></div>
							<div class="button1-left"><div class="forum"><a href="http://www.joomleague.de/forum/" alt="<?php echo _JL_ADMIN_FORUM;?>" title="<?php echo _JL_ADMIN_FORUM;?>" target="blank"><?php echo _JL_ADMIN_FORUM;?></a></div></div>
							<div class="button1-left"><div class="about"><a href="http://www.joomleague.de" alt="<?php echo _JL_ADMIN_INFO;?>" title="<?php echo _JL_ADMIN_INFO;?>" target="blank"><?php echo _JL_ADMIN_INFO;?></a></div></div>
				</div>
				<div class="button1-left"><div class="blank"><a href="index2.php?option=com_joomleague"></a></div></div><span class="step">
				<?php echo _JL_ADMIN_EDIT_FORM_PROJECTS_TITLE5;?></span>
			</div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
    </div>
<!-- Header END -->     

    <div id="installer">
    
<!-- Title START -->    
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
      	<h2><?php echo _JL_ADMIN_EDIT_FORM_PROJECTS_TITLE5;?></h2>		
<!-- Titel END -->

<!-- Info START -->	  			
		<div id="step">
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
<table class="content" cellpadding="4">
 <tr>
  <td><?php echo _JL_ADMIN_EDIT_FORM_PROJECTS_HINT5;?></td>
  <td align="right" valign="center" nowrap><?php echo _JL_ADMIN_EDIT_LIST_PROJECTS_DISPLAY;?><?php echo $pageNav->writeLimitBox(); ?></td>
 </tr>
</table>
			</div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
    </div>
<!-- Info END -->				

<!-- Content START -->			
				<div class="install-text2">
	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist2">
  	<thead>
    <tr>
  		<th width="20" class="title">
  			<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
  		</th>
      <th align="center" nowrap="nowrap" width="20"><?php echo _JL_ADMIN_EDIT_LIST_PROJECTS_ID;?></th>
      <th width="20">&nbsp;</th>
  		<th align="left" nowrap="nowrap"><?php echo _JL_ADMIN_EDIT_LIST_PROJECTS_NAME;?></th>
  		<th width="10%" align="left" nowrap="nowrap"># <?php echo _JL_ADMIN_VIEW_PROJECTS;?></th>
  		<th width="10%" align="left" nowrap="nowrap"># <?php echo 'Admins';?></th>
      <th width="10%" align="center" nowrap="nowrap"><?php echo _JL_ADMIN_PUBLISHED;?></th>
  	</tr>
  	</thead>
<?php
		$k = 0;
		for ($i=0, $n=count( $rows ); $i < $n; $i++) {
			$row = &$rows[$i];
			
			$thisprediction = new JLPrediction($database);
			$thisprediction->load($row->id);
			$pred_projects = $thisprediction->getChilds();
			mosMakeHtmlSafe($row);
       		$link = JL_ADMIN_COMPONENT_LINK.'&adminmode='.JL_ADMIN_MODE.'&act=predictions&task=edit&cid[]='. $row->id;
       		//$row->tmpeditor=$row->editor;
       		$row->editor=$row->checkoutuser;
       		$checked = mosCommonHTML::CheckedOutProcessing( $row, $i );     
?>
			<tr class="<?php echo "row$k"; ?>">
				<td width="20">			
				<?php echo $checked; ?>
				</td>
        <td><b><?php echo $row->id; ?></b></td>
        <td width="20">
        <a href="<?php echo $link; ?>">
          <img src="<?php echo _JOOMLA_JL_LIVE_SITE;?>/components/com_joomleague/frontend/default/images/edit.png" border="0" alt="<?php
          echo _JL_EDIT_DETAILS;?>" title="<?php
          echo _JL_EDIT_DETAILS.'"';
          if ($row->checked_out != $my->id) echo ' onclick="return listItemTask(\'cb'.$i.'\',\'edit\')" /></a>';?>
        </a>
      </td>
				<td>
					<a href="javascript:void(0)" title="USE <?php echo $row->name; ?>" onclick="show_hide_nav('child<?php echo $row->id;?>', '', true)">
						<?php echo $row->name; ?>
					</a>
				</td>
			  <td width="10%">
			  <?php echo count($pred_projects); ?></b></span></td>
			  <td width="10%"><?php echo count($thisprediction->getAdmins()); ?></td>
<?php

      $task = $row->published ? 'unpublish' : 'publish';
			$img = $row->published ? 'tick.png' : 'publish_x.png';
?>
      <td width="10%" align="center">
        <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')">
          <img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="" />
        </a>
      </td>
    </tr>
    <tr style="margin:0;padding:0;height:0;"><td colspan="7" style="margin:0;padding:0;height:0;"><div id="child<?php echo $row->id;?>" style="display:none;">
      <table width="90%" align="right">
<?php
if (count($pred_projects) > 0) {
			  $childnames = array();
			  foreach($pred_projects AS $key=>$value) {
          $query = "SELECT name FROM #__joomleague WHERE id = ".$value['project_id'];
          $database->setQuery($query);
          $childname =  $database->loadResult();
          $thisSettings = new JLPredictionSetting($database);
          $thisSettings->load( $key );
          //mosMakeHtmlSafe($thisSettings);
       		$link = JL_ADMIN_COMPONENT_LINK.'&adminmode='.JL_ADMIN_MODE.'&act=prediction_setting&task=edit&cid[0]='. $thisSettings->id;
       		
       		//$thisSettings->editor=$thisSettings->checked_out;
       		//$Setchecked = mosCommonHTML::CheckedOutProcessing( $thisSettings, $m ); 
 ?>
  
  <tr class="<?php echo "row$k"; ?>">
  <td width="20">			
				<?php
				//echo $Setchecked;
				 ?>
				</td>
        <td width="20"><b><?php echo $thisSettings->id; ?></b></td>
    <td>
    <a href="<?php echo $link;?>" onclick="document.getElementById('act').value='prediction_setting';"><?php echo $childname.'</a>';
  ?>
    </td>
  </tr>
<?php
//$m++;
      }
    } ?>
</table></div></td></tr><?php
    		$k = 1 - $k; } ?>
			
			<tr>
				<td align="center" colspan="10"><?php echo $pageNav->writePagesLinks(); ?></td>
			</tr>
			<tr>
				<td align="center" colspan="10"><?php echo $pageNav->writePagesCounter(); ?></td>
			</tr>
		</table>
				</div>
<!-- Content END -->	
			
        <div class="clr"></div>
      </div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
		</div>
	</div>
</div>
<div class="clr"></div>
<input type="hidden" name="option" value="<?php echo JL_OPTION;?>" />
<input type="hidden" id="act" name="act" value="<?php echo JL_ACTION;?>" />
<input type="hidden" name="adminmode" value="<?php echo JL_ADMIN_MODE;?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
</form>
